create database GiaVang
go
use GiaVang
go
CREATE TABLE VangSJC(
Ngay date primary key default DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())),
GiaMua decimal not null,
GiaBan decimal not null,
NgayTao datetime default getdate(),
NgayCapNhat datetime
)
CREATE TABLE VangSJC(
Ngay date primary key default getdate(),
GiaMua decimal not null,
GiaBan decimal not null,
NgayTao datetime default getdate(),
NgayCapNhat datetime
)
drop table VangSJC
select * from VangSJC
delete VangSjc

Insert into VangSJC(Ngay,GiaMua,GiaBan) values('11/3/2011',44950,45200)
Insert into VangSJC(Ngay,GiaMua,GiaBan) values('11/04/2011',45400,45700)
Insert into VangSJC(Ngay,GiaMua,GiaBan) values('11/05/2011',45300,45600)
Insert into VangSJC(Ngay,GiaMua,GiaBan) values('11/06/2011',45300,45600)
Insert into VangSJC(Ngay,GiaMua,GiaBan) values('11/07/2011',45600,45850)
Insert into VangSJC(Ngay,GiaMua,GiaBan) values('11/08/2011',46350,46550)
Insert into VangSJC(Ngay,GiaMua,GiaBan) values('11/09/2011',46400,46600)
Insert into VangSJC(Ngay,GiaMua,GiaBan) values('11/10/2011',46100,46300)

use Northwind
go
SELECT CategoryName, COUNT(*) as ProductCount 
FROM Products p INNER JOIN Categories c ON c1.CategoryID = p.CategoryID 
GROUP BY CategoryName ORDER BY CategoryName

SELECT Ngay,GiaMua,GiaBan From VangSJC